<?php
/**
* This file holds classes for Application_Model_BusStop and Application_Model_Coordinates.
* @package busmap
*/

/**
* This class holds Application_Model_BusStop class, that manipulates with BusStop objects.
* @package busmap
*/
class Application_Model_BusStop
{
    protected $_name;
    protected $_coordinates;
    protected $_deleteTime;
    protected $_id;
  
	/**
	* Constructor with optional options array.
	*/
    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
		$this->_coordinates = new Application_Model_Coordinates();
    }
 
	/**
	* Universal setter function that gets a name and a value for the BusStop object property.
	*/
    public function __set($name, $value){
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid BusStop property');
        }
        $this->$method($value);
    }
	/**
	* Universal getter function that gets the value of a BusStop property with the given name.
	*/
    public function __get($name){
	       $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid BusStop property');
        }
        return $this->$method();
	}
 
 	/**
	* Setter function for the name property.
	*/
    public function setName($name){
		$this->_name = $name;
		return $this;
	}
	/**
	* Getter function for the name property.
	*/
    public function getName(){
		return $this->_name;
	}
 
 	/**
	* Setter function for the coordinates property.
	*/
    public function setCoordinates($coordinates){
		$this->_coordinates = $coordinates;
		return $this;
	}
	/**
	* Getter function for the coordinates property.
	*/
    public function getCoordinates(){
		return $this->_coordinates;
	}

 	/**
	* Setter function for the x property of the coordinates property.
	*/
    public function setXCoordinate($coordinate){
		$this->_coordinates->x = $coordinate;
		return $this;
	}
	/**
	* Getter function for thee x property of the coordinates property.
	*/
    public function getXCoordinate(){
		return $this->_coordinates->x;
	}

 	/**
	* Setter function for thee y property of the coordinates property.
	*/
    public function setYCoordinate($coordinate){
		$this->_coordinates->y = $coordinate;
		return $this;
	}
	/**
	* Getter function for thee y property of the coordinates property.
	*/
    public function getYCoordinate(){
		return $this->_coordinates->y;
	}
 
 	/**
	* Setter function for the deleteTime property.
	*/
    public function setDeleteTime($ts){
		$this->_deleteTime = $ts;
		return $this;
	}
	/**
	* Getter function for the deleteTime property.
	*/
    public function getDeleteTime(){
		return $this->_deleteTime;
	}
 
 	/**
	* Setter function for the id property.
	*/
    public function setId($id){
		$this->_id = $id;
		return $this;
	}
	/**
	* Getter function for the id property.
	*/
    public function getId(){
		return $this->_id;
	}

	/**
	* Function that returns an array with the property values of this object.
	*/
	public function toArray(){
		$result = array();
		$result['id'] = $this->getId();
		$result['name'] = $this->getName();
		$result['xCoordinate'] = $this->getXCoordinate();
		$result['yCoordinate'] = $this->getYCoordinate();
		$result['deleteTime'] = $this->getDeleteTime();
		return $result;
	}
}

/**
* This class holds Application_Model_Coordinates class, that manipulates with Coordinates objects for the BusStop objects.
* @package busmap
*/
class Application_Model_Coordinates{
	protected $_x;
    protected $_y;
   
	/**
	* Constructor with optional options array.
	*/
    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }
 
	/**
	* Universal setter function that gets a name and a value for the Coordinates object property.
	*/
    public function __set($name, $value){
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid Coordinates property');
        }
        $this->$method($value);
    }
	/**
	* Universal getter function that gets the value of a Coordinates property with the given name.
	*/
    public function __get($name){
	       $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid Coordinates property');
        }
        return $this->$method();
	}
 
 	/**
	* Setter function for the x property.
	*/
    public function setX($x){
		$this->_x = $x;
		return $this;
	}
	/**
	* Getter function for the x property.
	*/
    public function getX(){
		return $this->_x;
	}
 
 	/**
	* Setter function for the y property.
	*/
    public function setY($y){
		$this->_y = $y;
		return $this;
	}
	/**
	* Getter function for the y property.
	*/
    public function getY(){
		return $this->_y;
	}
}
